//
//  BaseController.m
//  BCNADemo
//
//  Created by 马东朝 on 2018/5/3.
//  Copyright © 2018年 马东朝. All rights reserved.
//

#import "BaseController.h"

@interface BaseController ()

@end

@implementation BaseController
- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    [self.navigationController setNavigationBarHidden:YES];
}
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.view.backgroundColor = [UIColor colorWithHexString:@"#12121f"];
    //定制左按钮
    self.but= [UIButton buttonWithType:UIButtonTypeCustom];
    _but.frame =CGRectMake(kWidth(60),kHeight(90), kWidth(80), kWidth(80));
    [_but setImage:[[UIImage imageNamed:@"fanhui@3x.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] forState:UIControlStateNormal];
    [_but addTarget:self action:@selector(popView:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:_but];
    [self.view addSubview:self.titleLabel];
}
- (UILabel *)titleLabel{
    if (!_titleLabel) {
        _titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(_but.frame), 0, ScreenWidth - CGRectGetMaxX(_but.frame) * 2 , 44)];
        _titleLabel.center = CGPointMake(ScreenWidth/2, _but.center.y);
        _titleLabel.textColor = [UIColor whiteColor];
        _titleLabel.font = [UIFont systemFontOfSize:kHeight(60)];
        _titleLabel.textAlignment = NSTextAlignmentCenter;
    }
    return _titleLabel;
}
- (void)popView:(UIButton *)sender{
    [self.navigationController popViewControllerAnimated:YES];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
